#include <iostream>
using namespace std;
/*
	error: request for member ‘work’ is ambiguous
*/
class A
{
public:
	A()
	{
		cout<<"A构造"<<endl;
	}
	~A()
	{
		cout<<"A析构"<<endl;
	}
	void work()
	{
		cout<<"A work"<<endl;
	}
private:
	int age;
};

class B:virtual public A
{
public:
	B()
	{
		cout<<"B构造"<<endl;
	}
	~B()
	{
		cout<<"B析构"<<endl;
	}
};

class C:virtual public A
{
public:
	C()
	{
		cout<<"C构造"<<endl;
	}
	~C()
	{
		cout<<"C析构"<<endl;
	}
};

class D:public B,public C
{
public:
	D()
	{
		cout<<"D构造"<<endl;
	}
	~D()
	{
		cout<<"D析构"<<endl;
	}
};

int main()
{
	D d;
	d.work(); 
}